package com.cici.service.impl;

//怎么改里面的配置文件？？？TODO
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cici.body.requestbody.TbTestAddressCreateRequestBody;
import com.cici.body.requestbody.TbTestAddressUpdateRequestBody;
import com.cici.entity.TbTestAddress;
import com.cici.exception.ExceptionEnumImpl;
import com.cici.exception.common.RestBadRequestException;
import com.cici.mapper.TbTestAddressMapper;
import com.cici.service.ITbTestAddressService;
import com.cici.tools.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.util.List;





/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cici
 * @since 2018-12-01
 */
@Slf4j
@Service
public class TbTestAddressServiceImpl extends ServiceImpl<TbTestAddressMapper, TbTestAddress> implements ITbTestAddressService {

    @Autowired
    private TbTestAddressMapper tbTestAddressMapper;

     @Override
     public TbTestAddress create(TbTestAddressCreateRequestBody body){
         TbTestAddress tbTestAddress = new TbTestAddress();
         BeanUtils.copy(body,tbTestAddress);
         log.info("id" + tbTestAddress.getId());
         log.info("id" + body.getId());
         if (tbTestAddressMapper.insert(tbTestAddress)<1){
             throw new RestBadRequestException(ExceptionEnumImpl.CREATE_ERROR,"创建失败");
         }
         return baseMapper.selectById(body.getId());


     }

     @Override
     public  TbTestAddress update(Long id, TbTestAddressUpdateRequestBody body){


             return null;
     }

     @Override
     public List<TbTestAddress> selectTbTestAddressList(){
             return null;

     }

    @Override
    public TbTestAddress getTbTestAddress() {
        Long id = 1069066494316490754L;
        TbTestAddress tbTestAddress = tbTestAddressMapper.selectById(id);
        return tbTestAddress;
    }

    @Override
     public boolean delete(Long id){

             return false;

     }

}
